package com.lxq.LeetCode.canConstruct;

public class Solution {
    public static void main(String[] args) {

    }
    public static boolean canConstruct(String ransomNote, String magazine) {
        int[] alphabeta = new int[26];
        for (int i = 0; i < ransomNote.length(); i++) {
            int tag = ransomNote.charAt(i) - 'a';
            alphabeta[tag]--;
        }
        for (int i = 0; i < magazine.length(); i++) {
            int tag = magazine.charAt(i) - 'a';
            alphabeta[tag]++;
        }
        for (int i = 0; i < 26; i++) {
            if (alphabeta[i] < 0) {
                return false;
            }
        }
        return true;
    }
}
